package com.java_foundation.thread_demo.test_5;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @program: java_foundation
 * @description: 测试
 * @author: xiongbangwen <Email>xiongbangwen@163.com</Email>
 * @create: 2020-06-21 15:21
 **/
public class Test {
    public static void main(String[] args) {
        //Thread
        ThreadDemo td = new ThreadDemo();//创建线程
        td.start();//启动线程
        //Runnable
        RunnableDemo rd = new RunnableDemo();//创建
        new Thread(rd).start();//启动
        //Futuretask
        FutureTask<String> ft = new FutureTask<>(new FutureTaskDemo());//创建
        new Thread(ft).start();//启动
        try {
            String result = ft.get();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}
